package com.example.timeline;

import android.os.Bundle;
import android.os.PersistableBundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;

import com.androidkun.PullToRefreshRecyclerView;
import com.example.timeline.checktype.CheckDataItem;
import com.example.timeline.recycleAdapter.CommonAdapter;

import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2017/9/28 0028.
 */

public class RCommAdapterListActivity extends AppCompatActivity {
    private PullToRefreshRecyclerView pullToRefreshRecyclerView;
    private CommonAdapter<JSONObject> commonAdapter ;
    private List<CommonAdapter.DataHandler<JSONObject>> handlers;
    private List<JSONObject> items;

    @Override
    protected void onResume() {
        super.onResume();
    }

    @Override
    protected void onPause() {
        super.onPause();
    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState) {
        super.onCreate(savedInstanceState, persistentState);
        setContentView(R.layout.activity_rcommadapterlist);
        pullToRefreshRecyclerView = (PullToRefreshRecyclerView) findViewById(R.id.main_view);
        handlers = new ArrayList<>();
        items = new ArrayList<>();
        CommonAdapter adapter = new CommonAdapter(items,handlers);
        pullToRefreshRecyclerView.setLayoutManager(new LinearLayoutManager(this));
        //设置adapter
        pullToRefreshRecyclerView.setAdapter(adapter);
        //设置Item增加、移除动画
        pullToRefreshRecyclerView.setItemAnimator(new DefaultItemAnimator());
    }
}
